home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / Host.man < prev    next >
Encoding:
Text File  |  1992-06-10  |  7.1 KB  |  201 lines

  1.  
  2.  
  3.  
  4. Host                  C Library Procedures                   Host
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NNAAMMEE
  11.      Host_ByName,  Host_ByID,  Host_ByNetAddr,   Host_ByInetAddr,
  12.      Host_SetFile,   Host_Start,  Host_Next,  Host_End  -  return
  13.      information about Sprite machines
  14.  
  15. SSYYNNOOPPSSIISS
  16.      ##iinncclluuddee <<hhoosstt..hh>>
  17.  
  18.      Host_Entry *
  19.      HHoosstt__BByyNNaammee(_n_a_m_e)
  20.  
  21.      Host_Entry *
  22.      HHoosstt__BByyIIDD(_s_p_r_i_t_e_I_D)
  23.  
  24.      Host_Entry *
  25.      HHoosstt__BByyNNeettAAddddrr(_a_d_d_r_P_t_r)
  26.  
  27.      Host_Entry *
  28.      HHoosstt__BByyIInneettAAddddrr(_i_n_e_t_A_d_d_r)
  29.  
  30.      int
  31.      HHoosstt__SSeettFFiillee(_f_i_l_e_N_a_m_e)
  32.  
  33.      int
  34.      HHoosstt__SSttaarrtt()
  35.  
  36.      Host_Entry *
  37.      HHoosstt__NNeexxtt()
  38.  
  39.      void
  40.      HHoosstt__EEnndd()
  41.  
  42.      int
  43.      HHoosstt__SSttaatt(_s_t_a_t_P_t_r)
  44.  
  45. AARRGGUUMMEENNTTSS
  46.      char              *_n_a_m_e      (in)      The name of a  Sprite
  47.                                             host for which infor-
  48.                                             mation is desired.
  49.  
  50.      int               _s_p_r_i_t_e_I_D   (in)      The Sprite ID of  the
  51.                                             host for which infor-
  52.                                             mation is desired.
  53.  
  54.      Net_Address       *_a_d_d_r_P_t_r   (in)      The   local   network
  55.                                             address  of  the host
  56.                                             for which information
  57.                                             is desired.
  58.  
  59.      Net_InetAddress   _i_n_e_t_A_d_d_r   (in)      The internet  address
  60.  
  61.  
  62.  
  63. Sprite v.1.0         Printed:  June 9, 1992                     1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Host                  C Library Procedures                   Host
  71.  
  72.  
  73.  
  74.                                             of the host for which
  75.                                             information        is
  76.                                             desired.
  77.  
  78.      char              *_f_i_l_e_N_a_m_e  (in)      The name of  a  host-
  79.                                             description file.
  80.  
  81.      struct            _s_t_a_t       (*statPtr)
  82.                                             Pointer    to    stat
  83.                                             structure   for  host
  84.                                             database file.
  85.  
  86. _________________________________________________________________
  87.  
  88. DDEESSCCRRIIPPTTIIOONN
  89.      These functions are used to learn about hosts on  the  local
  90.      Sprite  network.  These functions cause the host description
  91.      file to be opened.  HHoosstt__EEnndd(()) must be called to  close  the
  92.      file.
  93.  
  94.      A Host_Entry structure is defined as follows:
  95.  
  96.           typedef struct {
  97.               char        *name;         /* Primary name */
  98.               char        **aliases;     /* Other names */
  99.               int         id;            /* Sprite ID */
  100.               char        *machType;     /* Machine type, i.e "sun3" */
  101.               int         numNets;       /* Number of network interfaces the
  102.                                           * host has. */
  103.               Host_Interface  nets[HOST_MAX_INTERFACES];
  104.                                   /* Internet and physical address for
  105.                                    * each network interface. */
  106.           } Host_Entry;
  107.  
  108.           typedef struct Host_Interface {
  109.               Net_InetAddress     inetAddr;      /* Internet address */
  110.               Net_Address         netAddr;       /* Physical address */
  111.           } Host_Interface;
  112.  
  113.      The _n_u_m_N_e_t_s field indicates how many network interfaces  the
  114.      host has.  One entry in the _n_e_t_s array will be filled in per
  115.      interface.  Unused entries will have  the  network  type  in
  116.      _n_e_t_A_d_d_r _s_e_t _t_o NNEETT__AADDDDRREESSSS__NNOONNEE.
  117.  
  118.      The Host_Entry structures returned by the routines are stat-
  119.      ically  allocated  and  may  change  on the next call to any
  120.      HHoosstt__ procedure.  Be sure to copy out  any  information  you
  121.      need before calling a HHoosstt__ procedure again.
  122.  
  123.      HHoosstt__BByyNNaammee(()) returns a Host_Entry  based  on  the  name  or
  124.      alias of a host.
  125.  
  126.      HHoosstt__BByyIIDD(()) returns a Host_Entry for the host with the given
  127.      sprite ID.
  128.  
  129.  
  130.  
  131. Sprite v.1.0         Printed:  June 9, 1992                     2
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. Host                  C Library Procedures                   Host
  139.  
  140.  
  141.  
  142.      HHoosstt__BByyNNeettAAddddrr(()) returns the Host_Entry for  the  host  with
  143.      the given local-area-network address.
  144.  
  145.      HHoosstt__BByyIInneettAAddddrr(()) returns the Host_Entry for the  host  with
  146.      the given internet address.
  147.  
  148.      HHoosstt__SSeettFFiillee(()) specifies a different host  information  file
  149.      to use (the file normally used is //eettcc//sspprriitteehhoossttss).
  150.  
  151.      HHoosstt__SSttaarrtt(()) opens the current host-description file (if  it
  152.      isn't  already  open),  while  HHoosstt__EEnndd(())  closes  it.   The
  153.      HHoosstt__BByy... procedures automatically call HHoosstt__SSttaarrtt.
  154.  
  155.      HHoosstt__NNeexxtt(()) may be used to step through  the  current  host-
  156.      description  file.  The host-description file must have been
  157.      opened using HHoosstt__SSttaarrtt(()) or one of the HHoosstt__BByy functions.
  158.  
  159.      HHoosstt__SSttaatt(()) is used to get  the  statistics  for  the  host-
  160.      description  file.   See  the ssttaatt(()) man page for details on
  161.      the stat structure.  HHoosstt__SSttaatt(()) is useful if you are  writ-
  162.      ing  a  daemon  that  wants  to  do something when the host-
  163.      description file is updated. The daemon can loop waiting for
  164.      the  modify time of the file to change.  Make sure the host-
  165.      description file is closed (use HHoosstt__EEnndd(())) before the  dae-
  166.      mon  waits,  otherwise every machine running the daemon will
  167.      have the host-description file open, causing  lots  of  con-
  168.      sistency traffic.
  169.  
  170. DDIIAAGGNNOOSSTTIICCSS
  171.      HHoosstt__SSeettFFiillee(()),HHoosstt__SSttaarrtt(()) and HHoosstt__SSttaatt(()) return  zero  if
  172.      all went well.  Otherwise they return -1 and the eerrrrnnoo vari-
  173.      able  contains  additional  information  about  what   error
  174.      occurred.    HHoosstt__NNeexxtt(())   returns   NULL   on  end-of-file.
  175.      HHoosstt__BByyNNaammee(()),     HHoosstt__BByyIIDD(()),     HHoosstt__BByyNNeettAAddddrr(())     and
  176.      HHoosstt__BByyIInneettAAddddrr(()) return NULL if the given host could not be
  177.      found.
  178.  
  179. FFIILLEESS
  180.      /etc/spritehosts    The default host-description file.
  181.  
  182. KKEEYYWWOORRDDSS
  183.      hostname, internet address, local net, machine type,  sprite
  184.      ID
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197. Sprite v.1.0         Printed:  June 9, 1992                     3
  198.  
  199.  
  200.  
  201.